from camera import Camera
from gesture import GestureRecognizer


def main():
    camera = Camera()  # 创建摄像头处理对象
    recognizer = GestureRecognizer()  # 创建手势识别对象

    camera.start_camera()  # 启动摄像头
    try:
        while True:
            frame = camera.capture_frame()  # 捕获视频帧
            hand_landmarks, gesture = recognizer.recognize_gesture(frame)  # 识别手势
            camera.display_frame(frame, hand_landmarks, gesture)  # 显示带有手势信息的视频帧
    except KeyboardInterrupt:
        camera.release()  # 释放摄像头资源


if __name__ == "__main__":
    main()
